package com.cy.mall.web.comm;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.cy.mall.model.Result;
import com.cy.mall.service.comm.FileUploadService;
import com.cy.mall.web.BaseController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 公用方法-文件管理
 *
 * @author tanyilin
 *
 * @create 2019年2月27日 下午2:42:20
 */
@RestController
@RequestMapping("/file")
@Api(tags = "公用方法-文件管理")
public class FileController extends BaseController {

	@Autowired
	private FileUploadService fileUploadService;
	
	@ApiOperation("上传图片")
	@PostMapping("/upload/image")
	public Result uploadImage(@RequestParam(value = "file") MultipartFile file) {
		Result result = fileUploadService.uploadImage(file, "image/", null);
		return result;
	}
	
}
